#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e5 + 5;
const ll INF = 1e18;
ll n, d, k;
ll x[N], s[N];
ll f[N];
bool check(ll g) {
  ll mn = max(1ll, d - g), mx = d + g;
  deque<int> dq;
  int pos = 0;
  ll ans = 0;
  rep(i, 1, n) {
    int l = x[i] - mx, r = x[i] - mn;
    while (x[pos] <= r) {
      while (dq.size() && f[dq.back()] <= f[pos]) dq.pop_back();
      dq.push_back(pos++);
    }
    while (dq.size() && x[dq.front()] < l) dq.pop_front();
    if (dq.size())
      f[i] = f[dq.front()] + s[i];
    else
      f[i] = -INF;
    ans = max(ans, f[i]);
  }
  return ans >= k;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> d >> k;
  rep(i, 1, n) cin >> x[i] >> s[i];
  ll l = 0, h = 1e9;
  while (l <= h) {
    ll mid = (l + h) >> 1;
    if (check(mid))
      h = mid - 1;
    else
      l = mid + 1;
  }
  if (l > 1e9)
    cout << -1;
  else
    cout << l;
  return 0;
}